fix(ui): Format safe identifier phone number during sign in verification step#3751
Conversation
|
dstaley
left a comment
There was a problem hiding this comment.
approved, but if you want to get rid of that logical OR we can by adding a few overloads to formatSafeIdentifier
| <SignIn.SafeIdentifier /> | ||
| <SignIn.SafeIdentifier | ||
| transform={val => { | ||
| return formatSafeIdentifier(val) || val; |
There was a problem hiding this comment.
If we add some overloads to the formatSafeIdentifier function to tell TypeScript that it will always return a string if provided a string, we can remove this logical OR which won't ever be invoked since SafeIdentifier falls back to an empty string in the worse case.
| @@ -0,0 +1,15 @@ | |||
| import { stringToFormattedPhoneString } from '~/common/phone-number-field/utils'; | |||
There was a problem hiding this comment.
Nit: I think we should move this to ~/utils if it's something we plan to use across different areas of the codebase; this'll avoid the likelihood of circular imports (and just a little tidier)
I may go ahead and just make this change to avoid the back-and-forth
There was a problem hiding this comment.
Ooof actually just seen how this also relies on data etc. too. Let's come back to this
Description
Add formatSafeIdentifier util to format phone number during sign in verification step
BEFORE:

AFTER:

https://linear.app/clerk/issue/SDKI-121/signin-verifications-phone-number-should-be-formatted-according-to
Checklist
npm testruns as expected.npm run buildruns as expected.Type of change